<?php

// function __autoload($className){

//     require $className.".php"; 
// }
    //加载类
    function loadclass($url,$className){
        if(!isset($className) || !isset($url)) die("请指定实例化名称与路径");
        if(substr($url,0,strlen($url))!=="/") $url.="/";
        if(!file_exists($_SERVER['DOCUMENT_ROOT'].$url.$className.".php")) die("没有找到控制器：".$_SERVER['DOCUMENT_ROOT'].$url.$className.".php");
        require $_SERVER['DOCUMENT_ROOT'].$url.$className.".php"; 
        if(!class_exists($className)) die("没有找到类:".$className);
        return new $className;
    }

    //保存缓存文件
    function ob_callback($buffer)
    {
        is_dir("./config/cache") OR mkdir("./config/cache", 0777, true); 
        file_put_contents("./config/cache/".REQUEST_URI.".html",$buffer);
    }